﻿using System.Linq.Expressions;
using Basic.FormCollect.Model;
using Basic.FormModel.Column;
using Basic.FormModel.DB;
using Basic.FormModel.Model;

namespace Basic.FormCollect
{
    public interface ITableColumnCollect
    {
        long Add ( ColumnAdd data );
        bool CheckIsNull ( long formId );
        void Clear ( long formId );
        void ClearByTableId ( long tableId );

        void ClearByGroupId ( long groupId );

        void Delete ( DBTableColumn source );
        DBTableColumn Get ( long id );
        Result Get<Result> ( long id ) where Result : class;
        Result Get<Result> ( long id, Expression<Func<DBTableColumn, Result>> selector );
        Result[] GetsByFormId<Result> ( long formId ) where Result : class, new();

        Result[] GetsByFormId<Result> ( long formId, TableColGetParam param ) where Result : class, new();

        Result[] GetsByTableId<Result> ( long tableId, TableColGetParam param, Expression<Func<DBTableColumn, Result>> selector );

        Result[] GetsByTableId<Result> ( long tableId ) where Result : class, new();
        bool Set ( DBTableColumn source, ColumnSet set );
        bool SetColSpan ( DBTableColumn source, int span );
        bool SetGroupId ( DBTableColumn source, long groupId );
        void SetSort ( KeyValuePair<long, int>[] sort );
        void SetColSpan ( KeyValuePair<long, int>[] span );
        long AddCol ( ColFullAdd datum );
        int GetMaxSort ( long tableId, long groupId );
        long[] CheckIsNull ( long formId, long[] tableId );
        ColumnSort[] GetSorts ( long tableId, long groupId );
        void SetSort ( ColumnSort sour, ColumnSort to );
        Result[] Gets<Result> ( long[] ids ) where Result : class, new();
        ColSet[] GetsColSet ( long[] ids );

        ColSet GetColSet ( long id );
    }
}